﻿// Copyright © Microsoft Corporation.  All Rights Reserved.
// This code released under the terms of the 
// Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)

using System;
using System.Windows;
using Microsoft.Phone.Controls;

namespace FeatureOverview.Features.Controls
{
    public partial class WebBrowser : PhoneApplicationPage
    {
        public WebBrowser()
        {
            InitializeComponent();
            this.Loaded += (s, e) =>
                {
                    Go();
                };
        }

        private void _go_Click(object sender, RoutedEventArgs e)
        {
            Go();
        }

        private void Go()
        {
            string url = _url.Text;

            if (!url.ToLower().StartsWith("http://"))
            {
                url = "http://" + url;
            }

            Uri uri = new Uri(url);
            _webbrowser.Navigate(uri);
        }
    }
}